<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>预览，回放功能示例</title>
		<script src="hk_js/ezuikit.js"></script>
		<script src="hk_js/jquery.min.js"></script>
		<style>
			body {
				margin: 0;
			}
			
			.hint {
				font-size: 14px;
				line-height: 3em;
				color: gray;
			}
			
			#url,
			#url2,
			#accessToken {
				width: 100%;
			}
			
			.btn-container {
				margin: 10px;
			}
			
			.normal {
				color: green;
				margin: 5px;
			}
			
			.error {
				color: red;
				margin: 5px;
			}
		</style>

	</head>

	<body>
		<h2>预览，回放功能示例：</h2>
		<div class="btn-container">
			<center><button id="view"><h1>预览</h1></button></center><br><br><br>
			<center><button id="back"><h1>回放</h1></button></center>
		</div>
		<div id="playWind" style="width: 600px; height: 400px;"></div>
		<script>
			$("#view").click(function() {
				var url = "ezopen://open.ys7.com/D28173011/1.live";
				var accessToken = "at.4flb20yz00mnq97v0owalul1ascqxpws-8z4gmq1w44-06h2r82-noqe2hcij";
				var decoder = new EZUIKit.EZUIPlayer({
					id: 'playWind',
					autoplay: true,
					url: url,
					accessToken: accessToken,
					decoderPath: './hk_js', //decoderPath：${window.YOUR_PATH};请在生产模式输入ezuikit.js的绝对路径
					width: 600,
					height: 400,
					handleError: handleError,
					handleSuccess: handleSuccess,
				});
				// decoder.play();
			});
			
			$("#back").click(function() {
				var url = "ezopen://open.ys7.com/D28173011/1.rec?begin=20190904000000&end=20190904065959";
				var accessToken = "at.4flb20yz00mnq97v0owalul1ascqxpws-8z4gmq1w44-06h2r82-noqe2hcij";
				var decoder = new EZUIKit.EZUIPlayer({
					id: 'playWind',
					autoplay: true,
					url: url,
					accessToken: accessToken,
					decoderPath: './hk_js', //decoderPath：${window.YOUR_PATH};请在生产模式输入ezuikit.js的绝对路径
					width: 600,
					height: 400,
					handleError: handleError,
					handleSuccess: handleSuccess,
				});
				// decoder.play();
			});


			function handleError(e) {
				console.log('捕获到错误', e)
				// log(JSON.stringify(e),'error');
				//alert(e)
			}

			function handleSuccess() {
				console.log("播放成功回调函数，此处可执行播放成功后续动作");
			}

			// decoder.play();
		</script>

	</body>

</html>